# 杨辉三角2

class Solution(object):
    def getRow(self, rowIndex):
        """
        :type rowIndex: int
        :rtype: List[int]
        """
        result = list()
        # layer = list()
        # layer.append(1)
        # result.append(layer)
        for i in range(rowIndex):  # 4
            # if i == 0:
            #     continue
            layer = list()
            for j in range(i+1):  # i+1=1,2,3,4
                if j == 0 or j == i:
                    layer.append(1)
                else:
                    layer.append(result[i-1][j-1] + result[i-1][j])
            result.append(layer)
        return result[rowIndex]
